package com.study.dao;

import com.study.domain.Manager;
import com.study.domain.MyUser;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by think on 2016/7/30.
 */
@Repository
public class ManagerDao {
    @Resource
    private SqlSessionTemplate sqlSessionTemplate;

    public void addManager(Manager manager) {
        sqlSessionTemplate.insert("com.study.domain.Manager.addManager",manager);
    }

    public int count(){
        return sqlSessionTemplate.selectOne("com.study.domain.Manager.count");
    }

    public List<Manager> queryManagerList(){
        return sqlSessionTemplate.selectList("com.study.domain.Manager.queryManagersList");
    }

    public void updateManager(Manager manager) {
        sqlSessionTemplate.update("com.study.domain.Manager.updateManager", manager);
    }

    public void deleteManager(int id){
        sqlSessionTemplate.delete("com.study.domain.Manager.deleteManage", id);
    }
}
